package com.zzc.emotisenseclassroom.dao.EmotisenseScore;

import com.zzc.baseRepository.componet.impl.TableFile;
import com.zzc.baseRepository.componet.interfaces.BaseDao;
import com.zzc.emotisenseclassroom.dao.user.UserDao;
import com.zzc.emotisenseclassroom.domain.classScore.vo.EmotiSenseScoreVO;
import com.zzc.emotisenseclassroom.dto.emotisenseScore.EmotisenseScoreDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * Copyright Zzc
 * FileName: EmotisenseScoreDao
 * Author:   Zzc
 * Date:     2024/5/320:38
 * Description:课堂专注度评分表
 * hISTORY:
 * <author>  <time>     <version>    <desc>
 * 作者姓名   修改时间       版本号       描述
 * Zzc                   1.0.0
 */
@Mapper
@Repository
public interface EmotisenseScoreDao extends BaseDao {
    /**
     * 主键自增id
     */
    TableFile ID = new TableFile("id", "id", "主键自增id", JdbcType.BIGINT, Long.class, EmotisenseScoreDao.class);

    /**
     * 班级id
     */
    TableFile CLASS_ID = new TableFile("class_id", "classId", "班级id", JdbcType.BIGINT, Long.class, EmotisenseScoreDao.class);

    /**
     * 班级名称
     */
    TableFile CLASS_NAME = new TableFile("class_name", "className", "班级名称", JdbcType.VARCHAR, String.class, EmotisenseScoreDao.class);

    /**
     * 学号
     */
    TableFile USER_ID = new TableFile("user_id", "userId", "学号", JdbcType.BIGINT, Long.class, EmotisenseScoreDao.class);

    /**
     * 学校id
     */
    TableFile SCHOOL_ID = new TableFile("school_id", "schoolId", "学校id", JdbcType.BIGINT, Long.class, EmotisenseScoreDao.class);

    /**
     * 学校名称
     */
    TableFile SCHOOL_NAME = new TableFile("school_name", "schoolName", "学校名称", JdbcType.VARCHAR, String.class, EmotisenseScoreDao.class);

    /**
     * 真实姓名
     */
    TableFile REAL_NAME = new TableFile("real_name", "realName", "真实姓名", JdbcType.VARCHAR, String.class, EmotisenseScoreDao.class);

    /**
     * 评分
     */
    TableFile SCORE = new TableFile("score", "score", "评分", JdbcType.INTEGER, Integer.class, EmotisenseScoreDao.class);

    /**
     * 本次评分的课堂时间
     */
    TableFile CLASS_DATE = new TableFile("class_date", "classDate", "本次评分的课堂时间", JdbcType.TIMESTAMP, Date.class, EmotisenseScoreDao.class);

    @Override
    default String getTableName() {
        return "z_emotisense_score";
    }

    /**
     * 获取指定时间段的班级课堂专注度评分
     * @param dateBegin
     * @param dateEnd
     * @param schoolId
     * @param classId
     * @return
     */
    List<EmotiSenseScoreVO> getClassEmotisenseScore(@Param("dateStart") Date dateBegin, @Param("dateEnd") Date dateEnd,
                                                    @Param("schoolId") Long schoolId, @Param("classId") Long classId);

    /**
     * 获取指定时间段的学生课堂专注度评分
     * @param dateBegin
     * @param dateEnd
     * @param schoolId
     * @param classId
     * @param userId
     * @return
     */
    List<EmotiSenseScoreVO> getStudentEmotisenseScore(@Param("dateStart") Date dateBegin, @Param("dateEnd") Date dateEnd,
                                                    @Param("schoolId") Long schoolId, @Param("classId") Long classId, @Param("userId") Long userId);

    /**
     * 插入课堂专注度评分数据
     * @param scoreList 课堂专注度评分list
     */
    void insertScore(@Param("scoreList") List<EmotisenseScoreDTO> scoreList);
}
